package com.itheima.controller;

import com.itheima.entity.Result;
import org.springframework.web.bind.annotation.*;

@ControllerAdvice
@CrossOrigin(allowCredentials="true", allowedHeaders="*", methods={RequestMethod.GET,RequestMethod.POST}, origins="*")
public class BaseExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result error(Exception e){
        e.printStackTrace();
        return new Result("300",e.getMessage());
    }
}
